# -*- coding: utf-8 -*-
import os

# Program installation location
BASE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), "../"))

# Default profile location
APP_USER_DIR = os.path.expanduser("~/.xware-desktop")
PROFILE_DIR = os.path.join(APP_USER_DIR, "profile")
TMP_DIR = os.path.join(PROFILE_DIR, "tmp")

XWARED_LOCK = os.path.join(TMP_DIR, "xware_xwared.lock")
XWARED_SOCKET = os.path.join(TMP_DIR, "xware_xwared.socket")
XWARED_CONFIG_FILE = os.path.join(PROFILE_DIR, "etc/xwared.ini")

ETM_CFG_DIR = os.path.join(PROFILE_DIR, "cfg")
ETM_CFG_FILE = os.path.join(ETM_CFG_DIR, "etm.cfg")
ETM_PATCH_FILE = os.path.join(BASE_DIR, "etmpatch.so")
ETM_COMMANDLINE = (os.path.join(BASE_DIR, "chmns"),
                   os.path.join(BASE_DIR, "xware/lib/EmbedThunderManager"), "--verbose")

MOUNTS_FILE = os.path.join(PROFILE_DIR, "etc/mounts")
MOUNTS_FILE_HEADER = \
    "# This file is automatically generated by Xware Desktop. " \
    "Manually modifying this file via a text editor is not advised."

# ETM is running behind chmns, so it doesn't have the knowledge that the /tmp is being in another
# namespace
# the last slash is needed
ETM_MOUNTS_DIR = "/tmp/thunder/volumes/"
ETM_MOUNTS_DIR_WITHOUT_CHMNS = os.path.normpath(os.path.join(TMP_DIR, "thunder/volumes")) + "/"

XDG_CONFIG_HOME = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
